package com.weaver.shuiguict.action;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;

public class ChangeDocTemplateAction implements Action {
    public String defaultParam;

    @Override
    public String execute(RequestInfo requestInfo) {
        //获取表单主字段的信息
        try {
            Property[] propertyArry = requestInfo.getMainTableInfo().getProperty();
            for (Property property : propertyArry) {
                String name = property.getName();
                if ("wd".equals(name)) {
                    String updateSql = "Update docdetail Set selectedpubmouldid = 145 Where id = ?";
                    RecordSet recordSet = new RecordSet();
                    String value = Util.null2String(property.getValue());
                    String[] split = value.split(",");
                    for (String s : split) {
                        new BaseBean().writeLog("property.getName()====>" + name + ",property.getValue()===>" + value + ",splitValue="+s+",=======>" + updateSql);
                        recordSet.executeUpdate(updateSql, s);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            return Action.FAILURE_AND_CONTINUE;
        }
        return Action.SUCCESS;
    }

}
